/*
 * Message.h
 *
 *  Created on: 05/07/2013
 *      Author: gilvan
 */

#ifndef MESSAGE_H_
#define MESSAGE_H_

#include "Material.h"



class Message {
public:
	Message(void);
	virtual ~Message(void);



	void fromString(const String& str);

	virtual String toString(void) const = 0;
	virtual void notify(void) = 0;

	/// Separa os pedaços da mensagem, usando o símbolo | como separador
	static StringVector split(const String& str);

	const String& getCommand(void) const;
	bool isBroadcast(void) const;

protected:

	Message( const String& cmd, bool broad );

	virtual void _fromString(const StringVector& tokens ) = 0;

	String command;
	bool broadcast;

};

#endif /* MESSAGE_H_ */
